package com.ncs.controller;

import com.ncs.domain.Product;
import com.ncs.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yinyin
 * @create 2021/08/07 上午 9:12
 */
@Controller
public class ProductController {
    @Autowired
    private ProductService productService;
    @RequestMapping("findAll.do")
    @ResponseBody
    public Map<String, Object> findAll(){
        List<Product> productList = productService.findAll();
        Map <String, Object> map=new HashMap<>();
         map.put("product",productList);
         return  map;
    }
}
